<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        async function test() {
            await fetch("https://api.coze.cn/open_api/v2/chat", {
                method: "POST",
                mode: "no-cors",
                credentials: "include",
                stream: true,
                "Access-Control-Allow-Origin": "*",
                "Access-Control-Allow-Credentials": true,

                headers: {
                    "Content-Type": "application/json",
                    Authorization: `Bearer pat_zw5l2vLpOYKb5XgUVfFtfdYWgYmUMBQlw28XgDGSNSkchQMZBuSODMfhnWwJPwPg`,
                    // Authorization: `Bearer pat_NSIAr0YqnpLvCZdJOXktebwCEb1vl09uFhtIK79kdJGk1Kvebx3Pr6Of56vjKpUf`,
                    Connection: "keep-alive",
                    Accept: "*/*",
                    AccessControlAllowOrigin: "*"
                },

                withCredentials: true,
                body: JSON.stringify({
                    bot_id: "7386233614867939366",
                    user: 1,
                    query: '你好',
                    stream: true,
                    chat_history: []
                })
            }).then(res => {
                const reader = res.body.getReader();

                console.log(reader, "shuj");
            });
        }

        window.onload = function () {
            test()
        }
    </script>
</body>

</html>
